#include <stdio.h>
#include <string.h>


int main()
{
//1.指针类型（有*号）占用内存大小为8
    /*避免野指针，给一个处置NULL*/
   #if 0
   char * ptr = NULL;//指针对应一个地址

   char * ptr1 = "hello world";

   int len = sizeof(ptr1);
   printf("len:%d\n",len);

   int a = 5;
   int *pa = &a;
   len = sizeof(pa);
   printf("len:%d\n",len);

   short b = 10;
   short *pb = &b;
   len = sizeof(pb);
   printf("len:%d\n",len);
   #endif 

   #if 0
         /*字符串指针的赋值*/

         char *ptr = "hello world";
         /*字符串操作函数1： strlen*/

         int len = strlen(ptr);//
         printf("len:%d\n",len);


   #endif
   #if 1

   //字符串是有字符构成的
          char buffer[] = "hello world";
          for(int idx = 0;idx < sizeof(buffer); idx++)
          {
                      printf("buffer[%d] = %c\n", idx, buffer[idx]);

          }

   #endif
    

    return 0; 

}